#ifndef CMT_H_INCLUDED
#define CMT_H_INCLUDED
#include "cmtmsg.h"
#include <leaf/types.h>

typedef uint8_t        CmtId;
#define CMT_SINGLE     ((CmtId)0xff)

typedef uint8_t CmtPort;

typedef struct{
	CmtId   id;
	CmtPort port;
} *pCmt, Cmt;

typedef enum{
        CmtResetSave = 0,
        CmtResetHeading = 1,
        CmtResetObject  = 3,
        CmtResetAlignment = 4
}CmtResetType;

void cmt_init(Cmt *cmt, CmtPort port, CmtId id);
int  cmt_recv(Cmt *cmt, CmtMsg *msg);
void cmt_send(Cmt *cmt, CmtMsg *msg);
void cmt_request(Cmt *cmt, CmtMsg *req, CmtMsgId mid,size_t len, ...);
void cmt_reset( Cmt *cmt, CmtResetType type);


#endif  /* CMT_H_INCLUDED */
